from enum import Enum
from app.core.base_exception import BaseException


class SyncError(str, Enum):
    """同步模块错误枚举"""

    CHANGELOG_CREATE_FAILED = "CHANGELOG_CREATE_FAILED"
    GLOBAL_SEQ_GENERATE_FAILED = "GLOBAL_SEQ_GENERATE_FAILED"
    SNAPSHOT_CREATE_FAILED = "SNAPSHOT_CREATE_FAILED"
    SNAPSHOT_NOT_FOUND = "SNAPSHOT_NOT_FOUND"
    SNAPSHOT_EXPIRED = "SNAPSHOT_EXPIRED"
    SNAPSHOT_CHUNK_NOT_FOUND = "SNAPSHOT_CHUNK_NOT_FOUND"
    SNAPSHOT_TABLE_CREATE_FAILED = "SNAPSHOT_TABLE_CREATE_FAILED"
    SNAPSHOT_TABLE_DROP_FAILED = "SNAPSHOT_TABLE_DROP_FAILED"
    SNAPSHOT_DATA_QUERY_FAILED = "SNAPSHOT_DATA_QUERY_FAILED"
    CHANGES_QUERY_FAILED = "CHANGES_QUERY_FAILED"
    RETENTION_WINDOW_EXCEEDED = "RETENTION_WINDOW_EXCEEDED"
    INVALID_CHUNK_INDEX = "INVALID_CHUNK_INDEX"
    INVALID_SNAPSHOT_PARAMS = "INVALID_SNAPSHOT_PARAMS"

    # WebHook相关错误
    WEBHOOK_CREATE_FAILED = "WEBHOOK_CREATE_FAILED"
    WEBHOOK_NOT_FOUND = "WEBHOOK_NOT_FOUND"
    WEBHOOK_UPDATE_FAILED = "WEBHOOK_UPDATE_FAILED"
    WEBHOOK_DELETE_FAILED = "WEBHOOK_DELETE_FAILED"
    WEBHOOK_QUERY_FAILED = "WEBHOOK_QUERY_FAILED"
    WEBHOOK_REACTIVATE_FAILED = "WEBHOOK_REACTIVATE_FAILED"
    WEBHOOK_INVALID_TYPES = "WEBHOOK_INVALID_TYPES"
    WEBHOOK_INVALID_EVENTS = "WEBHOOK_INVALID_EVENTS"
    WEBHOOK_NOTIFICATION_FAILED = "WEBHOOK_NOTIFICATION_FAILED"
    WEBHOOK_SIGNATURE_FAILED = "WEBHOOK_SIGNATURE_FAILED"
    WEBHOOK_STATUS_UPDATE_FAILED = "WEBHOOK_STATUS_UPDATE_FAILED"


class SyncException(BaseException):
    """同步模块异常类"""

    pass
